<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>雷达</title>
    <META  HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no,width=device-width" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="app-mobile-web-app-capable" content="yes" />
    <meta name="app-mobile-web-app-status-bar-style" content="black-translucent" />

    <link rel="stylesheet" href="css/edit-OtherCard.css">
</head>
<body>
<div class="container">
    <!-- <p class="gray">成为你的客户null天</p> -->
    <form action="">
        <ul class="input_wrap bg-white">
            <!-- <li class="flex input_item">
                <div class="label">来源</div>
                <div class="flex1 tr">扫码</div>
            </li> -->
            <li class="flex input_item">
                <div class="label">姓名</div>
                <input id="name" type="text" class="flex1 tr" value="" placeholder="请输入">
            </li>
            <li class="flex input_item">
                <div class="label">微信绑定号码</div>
                <input id="wx_phone" type="text" class="flex1 tr" value="" placeholder="请输入">
            </li>
            <li class="flex input_item">
                <div class="label">手机号</div>
                <input id="phone" type="phone" class="flex1 tr" value="" placeholder="请输入">
            </li>
            <li class="flex input_item">
                <div class="label">邮箱</div>
                <input id="email" type="text" class="flex1 tr" value="" placeholder="请输入">
            </li>
            <li class="flex input_item">
                <div class="label">公司</div>
                <input id="company" type="text" class="flex1 tr" value="" placeholder="请输入">
            </li>
            <li class="flex input_item">
                <div class="label">职位</div>
                <input id="position" type="text" class="flex1 tr" value="" placeholder="请输入">
            </li>
            <li class="flex input_item">
                <div class="label">生日</div>
                <input id="birthday" type="date" class="flex1 tr" value="" placeholder="请输入">
            </li>
        </ul>
        <div class="flex input_item bg-white">
            <div class="label">备注</div>
            <textarea id="remark" name="" cols="30" rows="3" placeholder="请输入" maxlength="100"></textarea>
        </div>
        <div class="void"></div>
        <div class="button">
            <div id="save" class="save tc">保存</div>
        </div>
    </form>
</div>

<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>

<script type="text/javascript">




    window.onload = function()
    {
        var data = {
            'cus_im_id' : sessionStorage.getItem('chatwith'),
            'self_im_id' : sessionStorage.getItem('login_identifier'),
            'access':sessionStorage.getItem('access')
        };
        $.ajax({url:"https://qyim.ec51.com/v1/check/get-cus-info",type:"POST",data:data,success:function(result){
            //alert(result.data[0].cus_im_id);
            console.error(result)
            $("#name").val(result.data.name);
            $("#wx_phone").val(result.data.wx_phone);
            $("#phone").val(result.data.phone);
            $("#email").val(result.data.email);
            $("#company").val(result.data.company);
            $("#position").val(result.data.position);
            $("#birthday").val(result.data.birthday);
            $("#remark").val(result.data.remark);
            

        }});
    }
    $("#save").click(function(){
        var data = {
            'name' : $("#name").val(),
            'wx_phone':$("#wx_phone").val(),
            'phone':$("#phone").val(),
            'email':$("#email").val(),
            'company':$("#company").val(),
            'position':$("#position").val(),
            'birthday': $("#birthday").val(),
            'remark':$("#remark").val(),
            'cus_im_id' : sessionStorage.getItem('chatwith'),
            'self_im_id' : sessionStorage.getItem('login_identifier')
        };
        var data1={
            'cus-info' : data,
        }
        $.ajax({url:"https://qyim.ec51.com/v1/check/save-cus-info",type:"POST",data:data1,success:function(result){
            //alert(result.data[0].cus_im_id);
            if(result.data == 'ok'){alert('修改成功');history.back(-1)}else{alert('操作失败')}
        }});
    })
</script>
</body>
</html>